import { post } from "../utils/axios";
import Taro from '@tarojs/taro'

class Order {
  // 数据统计
  async baseData(data) {
    const res = await post("/offlinestore/agent.count/base", data);
    return res
  }
  //油品订单列表
  async OlisOrder(data) {
    data.app_id = Taro.getStorageSync('app_id')
    const res = await post("/offlinestore/agent.order/index", data);
    return res;
  }
  // 当前班次油品订单列表
  async OlisOrderNow(data) {
    data.app_id = Taro.getStorageSync('app_id')
    const res = await post("/offlinestore/agent.Order/current_shift_lists", data);
    return res;
  }
  // 上一班次油品订单列表
  async OlisOrderLast(data) {
    data.app_id = Taro.getStorageSync('app_id')
    const res = await post("/offlinestore/agent.Order/last_shift_lists", data);
    return res;
  }
  // 确认支付订单
  async confirmOrder(data) {
    const res = await post("/offlinestore/agent.order/confirmOrder", data);
    return res;
  }
  // 删除未支付订单
  async delOrder(data) {
    const res = await post("/offlinestore/agent.order/del", data);
    return res;
  }
  // 获取油枪列表
  async equipmentList(data) {
    const res = await post("/offlinestore/agent.cate/index", data);
    return res;
  }
  // 生成二维码订单
  async createQrcodeOrder(data) {
    const res = await post("/offlinestore/agent.order/createPayQrcode", data);
    return res;
  }
  // 查询二维码订单状态
  async checkQrcodeOrder(data) {
    const res = await post("/offlinestore/agent.order/checkPayQrcodeStatus", data);
    return res;
  }
  // 获取油品选项
  async getOilsOptions() {
    var data = {
      app_id: Taro.getStorageSync('app_id')
    }
    const res = await post("/offlinestore/agent.goods/select", data);
    return res;
  }
  // 未支付订单 确认
  async confirmOrder(data) {
    data.app_id = Taro.getStorageSync('app_id');
    const res = await post("/offlinestore/agent.order/confirmOrder", data);
    return res;
  }
  // 未支付订单 取消
  async delOrder(data) {
    data.app_id = Taro.getStorageSync('app_id');
    const res = await post("/offlinestore/agent.order/del", data);
    return res;
  }
  // 充值订单
  async voucherList(data) {
    data.app_id = Taro.getStorageSync('app_id');
    const res = await post("/offlinestore/agent.recharge/index", data);
    return res;
  }
}

export default new Order;
